{% extends "admin/common_base.html" %}

{% block main %}
<div class="main">
    <div class="body container">
        <div class="typecho-page-title">
            <h2>管理文章
                <a href="/admin/write/post">新增</a>
            </h2>
        </div>
        <div class="row typecho-page-main" role="main">
            <div class="col-mb-12 typecho-list">
                <div class="clearfix">
                    <ul class="typecho-option-tabs">
                        <li class="current">
                            <a href="/admin/manage/posts">可用</a>
                        </li>
                        <li>
                            <a href="?status=draft">草稿 </a>
                        </li>
                    </ul>
                </div>

                <div class="typecho-list-operate clearfix">
                    <form method="get">
                        <div class="operate">
                            <label>
                                <i class="sr-only">全选</i>
                                <input type="checkbox" class="typecho-table-select-all" />
                            </label>
                            <div class="btn-group btn-drop">
                                <button class="btn dropdown-toggle btn-s" type="button">
                                    <i class="sr-only">操作</i>选中项
                                    <i class="i-caret-down"></i>
                                </button>
                                <ul class="dropdown-menu">
                                    <li>
                                        <a lang="你确认要删除这些文章吗?" href="http://www.typecho.local/index.php/action/contents-post-edit?do=delete&_=ebca662ae6177cd80874d04a450f9be2">删除</a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <div class="search" role="search">
                            <input type="text" class="text-s" placeholder="请输入关键字" value="" name="keywords" />
                            <select name="category">
                                <option value="">所有分类</option>
                                <option value="1">默认分类</option>
                            </select>
                            <button type="submit" class="btn btn-s">筛选</button>
                        </div>
                    </form>
                </div>
                <!-- end .typecho-list-operate -->

                <form method="post" name="manage_posts" class="operate-form">
                    <div class="typecho-table-wrap">
                        <table class="typecho-list-table">
                            <colgroup>
                                <col width="20" />
                                <col width="6%" />
                                <col width="45%" />
                                <col width="" />
                                <col width="18%" />
                                <col width="16%" />
                            </colgroup>
                            <thead>
                                <tr>
                                    <th> </th>
                                    <th> </th>
                                    <th>标题</th>
                                    <th>作者</th>
                                    <th>分类</th>
                                    <th>日期</th>
                                </tr>
                            </thead>
                            <tbody>
                                {% for post in posts %}
                                    <tr id="post-{{post.cid}}">
                                        <td>
                                            <input type="checkbox" value="{{post.cid}}" name="cid[]" />
                                        </td>
                                        <td>
                                            <!-- <a href="http://www.typecho.local/admin/manage-comments.php?cid=1" class="balloon-button size-10"
                                                title="1 评论">1</a> -->
                                        </td>
                                        <td>
                                            <a href="/admin/write/post?cid={{post.cid}}">{{post.title}}</a>
                                            <a href="/admin/write/post?cid={{post.cid}}" title="编辑 {{post.title}}">
                                                <i class="i-edit"></i>
                                            </a>
                                            <a href="/post/{{post.cid}}" title="浏览 {{post.title}}">
                                                <i class="i-exlink"></i>
                                            </a>
                                        </td>
                                        <td>
                                            <a href="/admin/manage/posts">admin</a>
                                        </td>
                                        <td>
                                            {% for category in post.categories %}
                                                <a href="/admin/manage/posts?category={{category.mid}}">{{category.name}}</a>
                                            {% endfor %}
                                        </td>
                                        <td> {{post.created}} </td>
                                    </tr>
                                {% else %}
                                    <tr>
                                        <td colspan="6"><h6 class="typecho-list-table-title">没有任何文章</h6></td>
                                    </tr>
                                {% endfor %}
                            </tbody>
                        </table>
                    </div>
                </form>
                <!-- end .operate-form -->

                <div class="typecho-list-operate clearfix">
                    <form method="get">
                        <div class="operate">
                            <label>
                                <i class="sr-only">全选</i>
                                <input type="checkbox" class="typecho-table-select-all" />
                            </label>
                            <div class="btn-group btn-drop">
                                <button class="btn dropdown-toggle btn-s" type="button">
                                    <i class="sr-only">操作</i>选中项
                                    <i class="i-caret-down"></i>
                                </button>
                                <ul class="dropdown-menu">
                                    <li>
                                        <a lang="你确认要删除这些文章吗?" href="http://www.typecho.local/index.php/action/contents-post-edit?do=delete&_=ebca662ae6177cd80874d04a450f9be2">删除</a>
                                    </li>
                                </ul>
                            </div>
                        </div>

                        <ul class="typecho-pager">
                            <li class="current">
                                <a href="http://www.typecho.local/admin/manage-posts.php?page=1">1</a>
                            </li>
                        </ul>
                    </form>
                </div>
                <!-- end .typecho-list-operate -->
            </div>
            <!-- end .typecho-list -->
        </div>
        <!-- end .typecho-page-main -->
    </div>
</div>
{% endblock %}

{% block footer %}
<script>
    (function () {
        $(document).ready(function () {
            $('.typecho-list-table').tableSelectable({
                checkEl: 'input[type=checkbox]',
                rowEl: 'tr',
                selectAllEl: '.typecho-table-select-all',
                actionEl: '.dropdown-menu a,button.btn-operate'
            });

            $('.btn-drop').dropdownMenu({
                btnEl: '.dropdown-toggle',
                menuEl: '.dropdown-menu'
            });
        });
    })();
</script>
{% endblock %}